home *** CD-ROM | disk | FTP | other *** search
- on initializeplayer
- global playerLocData, playerSO, playerInventory
- playerLocData = [1, 0, point(225, 100), 0, 0, #Walk, #L, 1, 0, 0, 0, 0, 0]
- puppetSprite(playerSO, 1)
- set the member of sprite playerSO to "player Orb"
- set the ink of sprite playerSO to 36
- sprite(playerSO).locZ = 200
- playerInventory[2] = 0
- end
-
- on movePlayer
- global playerLocData, terrainData_Type, playerViewpoint, screenDimensions, inputString, playerSO, screenTileSize, anchorViewPoint, superPowers, monsterHitArea, monsterHarmArea, monsterSO, monsterData, bossDamageTaken, rumbleOffset, killOnlyOnce, bossIntro, jumpKeyMap, playerHealth
- hitSpikes = 0
- anchorViewPoint = point(0, 0)
- enemyHit = 0
- playerHit = 0
- if playerLocData[1] = 1 then
- repeat with wmon = 1 to count(monsterHitArea)
- if (inside(playerLocData[3] + point(0, 50), monsterHitArea[wmon]) = 1) and (playerLocData[2] = 0) then
- enemyHit = wmon
- next repeat
- end if
- if (inside(playerLocData[3] + point(0, 40), monsterHarmArea[wmon]) = 1) and (playerLocData[2] = 1) then
- playerHit = 1
- next repeat
- end if
- if (inside(playerLocData[3] + point(20, -40), monsterHarmArea[wmon]) = 1) and (playerLocData[10] = 0) then
- playerHit = 1
- next repeat
- end if
- if (inside(playerLocData[3] + point(-20, -40), monsterHarmArea[wmon]) = 1) and (playerLocData[10] = 0) then
- playerHit = 1
- next repeat
- end if
- if inside(playerLocData[3] + point(20, 0), monsterHarmArea[wmon]) = 1 then
- playerHit = 1
- next repeat
- end if
- if inside(playerLocData[3] + point(-20, 0), monsterHarmArea[wmon]) = 1 then
- playerHit = 1
- end if
- end repeat
- end if
- if bossDamageTaken = 1 then
- playerHit = 1
- end if
- if playerHit = 1 then
- rpoint = playerLocData[3]
- playerLocData[1] = 0
- end if
- if bossIntro > 0 then
- inputString = [0, 0, 0, 0, 0]
- else
- if playerLocData[1] = 1 then
- harvestinput()
- playerLocData[11] = 0
- else
- inputString = [0, 0, 0, 0, 0]
- playerLocData[11] = playerLocData[11] + 1
- end if
- end if
- jumpKeyMap = 4
- if (playerLocData[2] = 1) and (inputString[jumpKeyMap] = 1) then
- playerLocData[5] = -30
- playerLocData[2] = 0
- if playerLocData[13] = 0 then
- playSound("Jump SFX")
- end if
- else
- if enemyHit <> 0 then
- playerLocData[5] = -45
- playerLocData[2] = 0
- monsterData[enemyHit][5] = monsterData[enemyHit][5] + 1
- playSound("Jump On Enemy SFX")
- else
- if (playerLocData[2] = 0) and (inputString[jumpKeyMap] = 0) then
- if playerLocData[5] < -10 then
- playerLocData[5] = -10
- end if
- end if
- end if
- end if
- if inputString[4] = 1 then
- bData1 = checkSolidpoint(playerLocData[3])
- bData2 = checkSolidpoint(playerLocData[3] + point(0, -40))
- if (bData1[1] = 3) and (bData2[1] = 3) then
- if (inputString[1] = 0) and (inputString[2] = 0) then
- playerLocData[5] = 0
- playerLocData[2] = 1
- playerLocData[13] = 1
- end if
- end if
- end if
- if playerLocData[13] = 1 then
- if (inputString[1] = 1) or (inputString[2] = 1) then
- if inputString[4] = 1 then
- playerLocData[5] = -15
- playerLocData[2] = 0
- playerLocData[13] = 0
- else
- playerLocData[5] = 0
- playerLocData[2] = 0
- playerLocData[13] = 0
- end if
- else
- if inputString[5] = 1 then
- playerLocData[5] = -20
- playerLocData[2] = 0
- playerLocData[13] = 0
- else
- if inputString[4] = 1 then
- bData2 = checkSolidpoint(playerLocData[3] + point(0, -40))
- if bData2[1] = 3 then
- playerLocData[3] = playerLocData[3] + point(0, -5)
- end if
- if ((playerLocData[3][1] + 25) mod 50) < 25 then
- playerLocData[3][1] = playerLocData[3][1] - 2
- else
- playerLocData[3][1] = playerLocData[3][1] + 2
- end if
- else
- if inputString[3] = 1 then
- bData2 = checkSolidpoint(playerLocData[3] + point(0, 40))
- if bData2[1] = 3 then
- playerLocData[3] = playerLocData[3] + point(0, 5)
- end if
- if ((playerLocData[3][1] + 25) mod 50) < 25 then
- playerLocData[3][1] = playerLocData[3][1] - 2
- else
- playerLocData[3][1] = playerLocData[3][1] + 2
- end if
- end if
- end if
- end if
- end if
- end if
- if superPowers = 1 then
- maxHSpeed = 12
- else
- maxHSpeed = 10
- end if
- if (inputString[1] = 1) and (playerLocData[10] = 0) then
- playerLocData[4] = playerLocData[4] - 3
- if playerLocData[4] < (0 - maxHSpeed) then
- playerLocData[4] = 0 - maxHSpeed
- end if
- playerLocData[7] = #left
- playerLocData[6] = #Run
- anchorViewPoint[1] = -75
- else
- if (inputString[2] = 1) and (playerLocData[10] = 0) then
- playerLocData[4] = playerLocData[4] + 3
- if playerLocData[4] > maxHSpeed then
- playerLocData[4] = maxHSpeed
- end if
- playerLocData[7] = #right
- playerLocData[6] = #Run
- anchorViewPoint[1] = 75
- else
- repeat with whichRep = 1 to 2
- if playerLocData[4] > 0 then
- playerLocData[4] = playerLocData[4] - 1
- next repeat
- end if
- if playerLocData[4] < 0 then
- playerLocData[4] = playerLocData[4] + 1
- end if
- end repeat
- case playerLocData[7] of
- #left:
- anchorViewPoint[1] = -50
- #right:
- anchorViewPoint[1] = 50
- end case
- playerLocData[6] = #idle
- end if
- end if
- checkWallState = 1
- if playerLocData[4] > 0 then
- groundTest = playerLocData[3] + point(25, 0)
- spikeTest = playerLocData[3] + point(20, 0)
- checkWallState = 1
- else
- if playerLocData[4] < 0 then
- groundTest = playerLocData[3] - point(30, 0)
- spikeTest = playerLocData[3] - point(25, 0)
- checkWallState = 1
- else
- checkWallState = 0
- end if
- end if
- if checkWallState = 1 then
- testTheWall1 = checkSolidpoint(groundTest + point(0, 40))
- testTheWall2 = checkSolidpoint(groundTest + point(0, 0))
- testTheWall3 = checkSolidpoint(groundTest + point(0, -40))
- testSpikeWall1 = checkSolidpoint(spikeTest + point(0, 30))
- testSpikeWall2 = checkSolidpoint(spikeTest + point(0, 0))
- testSpikeWall3 = checkSolidpoint(spikeTest + point(0, -30))
- if (testSpikeWall1[2] = 10) or (testSpikeWall2[2] = 10) or (testSpikeWall3[2] = 10) then
- hitSpikes = 1
- end if
- if (testSpikeWall1[2] = 11) or (testSpikeWall2[2] = 11) or (testSpikeWall3[2] = 11) then
- hitSpikes = 2
- end if
- if (testTheWall1[1] = 1) or (testTheWall2[1] = 1) or (testTheWall3[1] = 1) then
- playerLocData[4] = 0
- playerLocData[3][1] = playerLocData[3][1] - (playerLocData[3][1] mod screenTileSize) + integer(screenTileSize / 2.0)
- end if
- end if
- if playerLocData[2] = 0 then
- playerLocData[5] = playerLocData[5] + 2
- verticalMove = playerLocData[5]
- if verticalMove < -15 then
- verticalMove = -15
- end if
- if verticalMove > 15 then
- verticalMove = 15
- end if
- playerLocData[3][2] = playerLocData[3][2] + verticalMove
- if playerLocData[5] > 0 then
- groundTest = playerLocData[3] + point(0, 50)
- testTheGround1 = checkSolidpoint(groundTest + point(15, 0))
- testTheGround2 = checkSolidpoint(groundTest + point(-15, 0))
- testAbovePlatform1 = checkSolidpoint(groundTest + point(15, 0) - point(0, verticalMove))
- testAbovePlatform2 = checkSolidpoint(groundTest + point(-15, 0) - point(0, verticalMove))
- testSpikeGround1 = checkSolidpoint(groundTest + point(10, -10))
- testSpikeGround2 = checkSolidpoint(groundTest + point(-10, -10))
- if (testSpikeGround1[2] = 10) or (testSpikeGround2[2] = 10) then
- hitSpikes = 1
- end if
- if (testSpikeGround1[2] = 11) or (testSpikeGround2[2] = 11) then
- hitSpikes = 2
- end if
- foundPlatform = 0
- if (testTheGround1[1] = 2) or (testTheGround2[1] = 2) then
- if (testAbovePlatform1[1] = 0) or (testAbovePlatform2[1] = 0) then
- foundPlatform = 1
- end if
- end if
- if (testTheGround1[1] = 1) or (testTheGround2[1] = 1) then
- playerLocData[5] = 0
- playerLocData[2] = 1
- playerLocData[3][2] = playerLocData[3][2] - ((playerLocData[3][2] + 50) mod screenTileSize)
- else
- if foundPlatform = 1 then
- playerLocData[5] = 0
- playerLocData[2] = 1
- playerLocData[3][2] = playerLocData[3][2] - ((playerLocData[3][2] + 50) mod screenTileSize)
- end if
- end if
- else
- groundTest = playerLocData[3] - point(0, 50)
- testTheGround1 = checkSolidpoint(groundTest + point(15, 0))
- testTheGround2 = checkSolidpoint(groundTest + point(-15, 0))
- testAbovePlatform1 = checkSolidpoint(groundTest + point(15, 0) - point(0, verticalMove))
- testAbovePlatform2 = checkSolidpoint(groundTest + point(-15, 0) - point(0, verticalMove))
- testSpikeGround1 = checkSolidpoint(groundTest + point(10, -10))
- testSpikeGround2 = checkSolidpoint(groundTest + point(-10, -10))
- if (testSpikeGround1[2] = 10) or (testSpikeGround2[2] = 10) then
- hitSpikes = 1
- end if
- if (testSpikeGround1[2] = 11) or (testSpikeGround2[2] = 11) then
- hitSpikes = 2
- end if
- foundPlatform = 0
- if (testTheGround1[1] = 1) or (testTheGround2[1] = 1) then
- punchBlock(groundTest)
- playerLocData[5] = 0
- else
- if foundPlatform = 1 then
- playerLocData[5] = 0
- playerLocData[2] = 1
- playerLocData[3][2] = playerLocData[3][2] - ((playerLocData[3][2] + 50) mod screenTileSize)
- end if
- end if
- end if
- end if
- groundTest = playerLocData[3] + point(0, 50)
- testTheGround1 = checkSolidpoint(groundTest + point(20, 0))
- testTheGround2 = checkSolidpoint(groundTest + point(-20, 0))
- testTheGround3 = checkSolidpoint(groundTest + point(0, -10))
- if (testTheGround3[2] = 10) or (testTheGround3[2] = 11) then
- hitSpikes = 1
- end if
- if (testTheGround1[1] = 0) and (testTheGround2[1] = 0) then
- playerLocData[2] = 0
- if playerLocData[5] >= 0 then
- playerLocData[6] = #Fall
- else
- playerLocData[6] = #jump
- end if
- else
- conveyRight = 0
- conveyLeft = 0
- case testTheGround1[2] of
- 2:
- conveyRight = conveyRight + 1
- 3:
- conveyLeft = conveyLeft + 1
- end case
- case testTheGround2[2] of
- 2:
- conveyRight = conveyRight + 1
- 3:
- conveyLeft = conveyLeft + 1
- end case
- case testTheGround3[2] of
- 2:
- conveyRight = conveyRight + 1
- 3:
- conveyLeft = conveyLeft + 1
- end case
- if conveyRight > conveyLeft then
- playerLocData[3] = playerLocData[3] + point(3, 0)
- else
- if conveyRight < conveyLeft then
- playerLocData[3] = playerLocData[3] - point(3, 0)
- end if
- end if
- end if
- if inputString[3] = 1 then
- if playerLocData[10] < 3 then
- playerLocData[10] = playerLocData[10] + 1
- end if
- else
- if playerLocData[10] > 0 then
- playerLocData[10] = playerLocData[10] - 1
- end if
- end if
- if playerLocData[10] <> 0 then
- playerLocData[6] = #Crouch
- end if
- playerLocData[3][1] = playerLocData[3][1] + playerLocData[4]
- if (hitSpikes = 1) or (hitSpikes = 2) then
- playerLocData[1] = 0
- end if
- if playerLocData[12] > 1 then
- playerLocData[1] = 1
- playerLocData[12] = playerLocData[12] - 1
- set the foreColor of sprite playerSO to random(255)
- else
- set the foreColor of sprite playerSO to 255
- if playerLocData[1] = 0 then
- if playerHealth > 1 then
- playerLocData[1] = 1
- playerLocData[12] = 40
- playerHealth = playerHealth - 1
- playSound("Lose heart SFX")
- rpoint = playerLocData[3]
- else
- playerLocData[6] = #Dead
- end if
- end if
- end if
- if playerLocData[13] = 1 then
- playerLocData[6] = #Climb
- end if
- if superPowers = 1 then
- playerTitle = "Super"
- else
- playerTitle = "Normal"
- end if
- case playerLocData[6] of
- #Run:
- playerLocData[9] = playerLocData[9] + 1
- if playerLocData[9] > 1 then
- playerLocData[8] = playerLocData[8] + 1
- if playerLocData[8] > 4 then
- playerLocData[8] = 1
- end if
- playerLocData[9] = 0
- end if
- membername = "Player " & playerTitle & " Walk" & string(playerLocData[8])
- #idle:
- membername = "Player " & playerTitle & " Idle"
- #jump:
- membername = "Player " & playerTitle & " Jump"
- #Fall:
- membername = "Player " & playerTitle & " Fall"
- #Crouch:
- membername = "Player " & playerTitle & " Crouch"
- #Dead:
- membername = "Player " & playerTitle & " Dead"
- #Climb:
- cMod = (playerLocData[3][2] / 15 mod 2) + 1
- membername = "Player " & playerTitle & " Climb " & string(cMod)
- end case
- if (playerLocData[3][2] >= 550) and (playerLocData[1] = 1) then
- playerLocData[1] = 0
- playerLocData[11] = 45
- playerHealth = 0
- if killOnlyOnce = 1 then
- playSound("T-Roy Dies SFX")
- killOnlyOnce = 0
- end if
- extraBounce = -6
- else
- extraBounce = 0
- end if
- case playerLocData[7] of
- #left:
- sprite(playerSO).flipH = 1
- #right:
- sprite(playerSO).flipH = 0
- end case
- if playerLocData[1] = 0 then
- if playerLocData[11] < 45 then
- set the loc of sprite playerSO to playerLocData[3] - playerViewpoint + rumbleOffset
- set the member of sprite playerSO to membername
- sprite(playerSO).visible = 1
- if playerLocData[11] = 15 then
- playSound("T-Roy Dies SFX")
- end if
- else
- if playerLocData[11] = 45 then
- addPickup(3, 5, playerLocData[3] + point(-25, 0), point((random(50) - 25) / 10.0, -16 - random(4)))
- repeat with wAdd = 1 to 30
- addPickup(3, random(4), playerLocData[3] + point(-25, 0), point((random(50) - 25) / 10.0, -2 - random(12) + extraBounce))
- end repeat
- sprite(playerSO).visible = 0
- end if
- end if
- else
- sprite(playerSO).visible = 1
- set the loc of sprite playerSO to playerLocData[3] - playerViewpoint + rumbleOffset
- set the member of sprite playerSO to membername
- end if
- if inputString[3] = 1 then
- anchorViewPoint[2] = 100
- else
- anchorViewPoint[2] = 0
- end if
- anchorViewPoint = anchorViewPoint - point(290, 250) + playerLocData[3]
- end
-
- on setPMode modeType, modeFlip
- global playerLocData
- if (playerLocData[6] <> modeType) or (playerLocData[7] <> modeFlip) then
- playerLocData[8] = 0
- playerLocData[9] = 0
- end if
- playerLocData[6] = #modeType
- playerLocData[7] = modeFlip
- end
-
- on addScore scoreValue
- global playerScore, levelScore, updateScoreDisplayNOW
- levelScore = levelScore + scoreValue
- updateScoreDisplayNOW = 1
- end
-